The invention relates generally to display of video data in a computer system. More particularly, the invention relates to antialiasing of lines and/or points in a graphics display by gamma correction based on pixel area calculation.
Graphical images are represented in typical computer systems by individual points on a computer monitor known as pixels. There are typically thousands or several million pixels in a single computer display that are individually manipulated to form the two-dimensional and three-dimensional images which a user sees on the computer screen.
Each pixel is displayed at a specified intensity, with the intensity of each color component (e.g., red, green, and blue) pixel in a color system separately specified in accordance with the color model for the system. In monochrome systems, the pixel intensity is determined from the gray scale value of the pixel. In a typical computer graphics system, video driver circuitry specifies a voltage for each pixel displayed (or color component pixel in the case of RGB color systems). However, there is not a direct linear mapping between driver voltage levels and pixel intensity. Monitor response is nonlinear and a power law gamma correction curve describes the parametric relationship between the applied voltage (to the electron-gun or pixel driver) and the displayed pixel intensity. The calculation by which the applied voltage needed to display a particular intensity is determined is known as gamma correction of intensity. The precise value of the gamma parameter is monitor dependent and typically varies from 2.0 to 3.0, although the National Television System Committee (NTSC) has defined a signal standard value of 2.2. The shape of the correction curve depends, in part, on the gamma parameter value.
In typical computer graphics systems, the driver voltages associated with predetermined pixel intensity values are stored in lookup tables, the number of entries in the lookup table ideally equaling the possible number of pixel intensity values. In order to determine the voltage output level required to achieve a desired pixel (or sub-pixel) intensity, the table entry corresponding to that intensity level is looked up and the value therein applied to the driver circuitry.
In a computer graphics system, a line segment (which may be, but is not necessarily, a polygon boundary) has both length and width. Each line segment is bounded by two edges, the distance between the edges being the width of the line segment, and each edge is bounded by two endpoints, one at either end of each line segment edge. Similarly, although pixels are often thought of as points, each pixel has finite boundaries and a defined area. In a typical computer system with square pixels, the pixel boundaries are the top, bottom, and sides of the pixel and the area is equal to the height times the width (i.e., length of a side boundary times the length of a top or bottom boundary). If the pixel dimensions are normalized, then each pixel boundary has a length of one and the magnitude of the area of each pixel is advantageously one.
Because the pixels in a computer graphics system are arranged in a rectangular grid, and are typically rectangular, purely vertical and horizontal lines (or line segments) and boundaries are generally displayed relatively precisely and with little distortion. However, lines that are not oriented at right angles are not neatly mapped onto adjacent pixels and undesirable distortions and artifacts can occur because of the imperfect mapping between diagonal lines and/or boundaries and pixels forming the display. Moreover, the edges of lines and/or polygons often do not map to precisely defined locations on the pixel boundaries, such as when the edge is not parallel to a horizontal or vertical axis, which may further distort the displayed image.
In particular, a form of distortion colloquially referred to as xe2x80x9cjaggiesxe2x80x9d may occur because of the stair-stepping effect which can be seen when a diagonal line is represented by a series of diagonally adjacent pixels. This stair-stepping effect can be ameliorated by effectively blurring the pixels at the edge of a line.
Numerous techniques are known in the art for xe2x80x9cblurringxe2x80x9d the pixels, such as varying the intensity of certain pixels based on, for example, the percentage of pixel area covered by the line. However, many of the prior art techniques tend to be computationally complex, using complex filters and/or supersampling of pixels. Other prior art techniques reduced the need for extensive computations by using table look ups for antialiasing, at the cost of limiting adaptability (if the table entries were fixed) and necessarily requiring the implementation of unwieldy tables. Moreover, many of the prior art techniques are not readily scalable for wide lines of varying width as the computations quickly become impracticable given the performance constraints typically imposed.
Furthermore, lengthy tables can undesirably constrain the flexibility of a graphics system as table entries are typically predetermined and not readily modified, making it difficult for the graphics system to efficiently support multiple monitors and/or types of monitors that are unlikely to have identical operating characteristics.
In view of the foregoing, there is a need for a technique for antialiasing that is computationally efficient, does not require extensive tables, and is readily scalable.
The present invention provides an improved technique for antialiasing by gamma correction of pixel intensity of covered pixels wherein the pre-gamma corrected intensity is relative to the amount of the pixel covered by a line as determined from the intersections of the edges of a line and pixel boundaries. By applying gamma correction to a single pixel by linear interpolation on a cubic representation of a normalized gamma correction curve, the present invention does not require a lengthy lookup table. Moreover, the present invention is readily adaptable for operation with a variety of displays with differing gamma correction characteristics.
In an alternative embodiment of the present invention, line antialiasing is further enhanced by alpha-blending the line pixel with the background. In a second alternative embodiment of the present invention, the endpoints of antialiased line segments are evaluated appropriately by accurately assessing the amount of pixel area covered and varying the pixel intensity accordingly.